package com.example.administrator.fragmentdome3;

import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

public class ContentActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        String title = getIntent().getStringExtra(ContentFragment.INTENT_TEXT);
        FragmentManager fm = getFragmentManager();
        ContentFragment contentFragment = (ContentFragment) fm.findFragmentById(R.id.fragment_content);
        if (contentFragment == null) {
            contentFragment = ContentFragment.newInstance(title);
            fm.beginTransaction().add(R.id.fragment_content, contentFragment, "Content").commit();
        }
    }
}
